var api = require('../../utils/api.js')
var app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        show:0,
        lists:[]
    },

    addlist(){
        wx.navigateTo({
          url: '/pages/list/apply',
        })
    },

    seeinfo(ret){
        console.log(ret);
        var id=ret.currentTarget.dataset.i;

        wx.navigateTo({
          url: '/pages/rets/infob?id='+id
        })
    },

    sendmsg(ret){
        console.log(ret);
        var id=ret.currentTarget.dataset.i;
        var that=this;
        wx.showModal({
          title: '温馨提示',
          content: '确定发生提醒',
          complete: (res) => {
            if (res.confirm) {
              console.log(123);

              api.post({
                url: 'usersave/sendmsg',
                data: {id:id},
                success: data => {
                    console.log(data) 
    
                    wx.showToast({
                      title: data.msg,
                      icon:'none'
                    })
                }
            })


            }
          }
        })

    },

 
    getmysuqiu(){
        var that=this;
        var status=this.data.show;

        api.post({
            url: 'usersave/getoutsuqiulist',
            data: {},
            success: data => {
                console.log(data) 

                that.setData({
                    lists:data.data
                })
            }
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onShow(options) {
        this.getmysuqiu();
    },

    previewImage(e) {
        console.log(e);
        var id=e.currentTarget.dataset.i;
        var lists=this.data.lists;
        var imgs=lists[id].imgs;

        wx.previewImage({
            current: imgs[0], // 当前显示图片的http链接
            urls: imgs // 需要预览的图片http链接列表
        });

    },


})